package com.ruoyi.lvlian.domain;


import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.domain.SysDept;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 车辆信息对象 lv_vehicle_info
 *
 * @author liyuxi
 * @date 2024-06-06
 */
@Data
@ToString
@ApiModel(value = "车辆信息", description = "车辆信息")
//对车牌md5
public class VehicleInfo {
    private static final long serialVersionUID = 1L;
    /**
     * 车辆id
     */
    private String id;

    @ExcelProperty("车牌号码")
    @NotNull(message = "车牌号码不能为空")
    @ApiModelProperty(value = "车牌号码")
    private String plateNo;

    @ExcelProperty("车牌颜色")
    @ApiModelProperty(value = "车牌颜色  (黄色/蓝色/黄绿色)")
    private String plateColor;

    @ExcelProperty("车辆类型")
    @ApiModelProperty(value = "车辆类型")
    private String vehicleType;

    @ExcelProperty("车辆识别代号")
    @ApiModelProperty(value = "车辆识别代号")
    private String vin;
    /**
     * 车辆入网状态 0为入网 1已入网
     */
    @ApiModelProperty(value = "车辆入网状态 0为入网 1已入网")
    private String netStatus;
    @ExcelProperty("机动车所有人")
    @NotNull(message = "机动车所有人不能为空")
    @ApiModelProperty(value = "机动车所有人")
    private String vehicleOwner;

    @ExcelProperty("使用性质")
    @ApiModelProperty(value = "使用性质")
    private String useNature;

    @ExcelProperty("品牌型号")
    @ApiModelProperty(value = "品牌型号")
    private String vehicleBrand;

    @ExcelProperty("发动机号码")
    @ApiModelProperty(value = "发动机号码")
    private String engineNo;

    @ExcelProperty("行驶证注册日期")

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间", example = "2020-01-01", dataType = "string")
    private String registrationDate;

    @ExcelProperty("行驶证发证日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间", example = "2020-01-01", dataType = "string")
    private String approvedDate;

    @ExcelProperty("总质量")
    @ApiModelProperty(value = "总质量(kg）")
    private Double totalWeight;

    @ExcelProperty("整备质量")
    @ApiModelProperty(value = "整备质量(kg）")
    private Double emptyWeight;

    @ExcelProperty("核定载重量")
    @ApiModelProperty(value = "核定载重量(kg）")
    private Double loadCapacity;

    @ExcelProperty("检验有效期至")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间", example = "2020-01-01", dataType = "string")
    private String expirationDate;

    @ExcelProperty("行驶证发证机关")
    @ApiModelProperty(value = "行驶证发证机关")
    private String agency;

    /**
     * 创建对象
     */
    @ApiModelProperty(value = "创建对象")
    private String createUser;

    /**
     * 创建日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "创建时间", example = "2020-01-01", dataType = "string")
    private String createDate;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "修改时间", example = "2020-01-01", dataType = "string")
    private String updateDate;


    /**
     * 所属公司组织
     */
    @ExcelProperty("所属公司编码")
    @ApiModelProperty(value = "所属公司组织")
    private String orgCode;

    @ExcelProperty("所有人住址")
    @ApiModelProperty(value = "住址")
    private String address;


    @ApiModelProperty(value = "品牌型号")
    private String model;

    //    @NotNull(message = "行驶证正页不能为空")
    @ApiModelProperty(value = "行驶证正页")
    private String drivingLicenseImg;

    /**
     * 行驶证附页
     */
    @ApiModelProperty(value = "行驶证附页")
    private String drivingLicenseBackImg;

    @ExcelProperty("所有人电话")
    @ApiModelProperty(value = "所有人电话")
    private String phone;


    @ApiModelProperty(value = "车头照片")
    private String headImg;

    /**
     * 车尾照片
     */
    @ApiModelProperty(value = "车尾照片")
    private String tailImg;


    @ApiModelProperty(value = "驾驶证号")
    private String  licenseNo;


    public String getPlateColor() {
        if ("7001".equalsIgnoreCase(plateColor)) {
            return "3";
        }
        if ("7002".equalsIgnoreCase(plateColor)) {
            return "2";
        }
        if ("7003".equalsIgnoreCase(plateColor)) {
            return "1";
        }
        return plateColor;

    }

    public void setPlateColor(String plateColor) {
        this.plateColor = plateColor;
    }

    public String getUseNature() {
        if ("1".equalsIgnoreCase(useNature)) {
            return "货运";
        }

        return useNature;
    }

    public void setUseNature(String useNature) {
        this.useNature = useNature;
    }

    public String getDrivingLicenseImg() {
        if (StringUtils.isNotEmpty(drivingLicenseImg) && !drivingLicenseImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + drivingLicenseImg;
        }
        return drivingLicenseImg;
    }

    public String getDrivingLicenseBackImg() {
        if (StringUtils.isNotEmpty(drivingLicenseBackImg) && !drivingLicenseBackImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + drivingLicenseBackImg;
        }
        return drivingLicenseBackImg;
    }


    public String getHeadImg() {
        if (StringUtils.isNotEmpty(headImg) && !headImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + headImg;
        }
        return headImg;
    }

    public String getTailImg() {
        if (StringUtils.isNotEmpty(tailImg) && !tailImg.contains("http")) {
            return "https://data.lvlianhengsheng.com/dev-api/file/fileAttachmentInfo/viewImage?key=" + tailImg;
        }
        return tailImg;
    }
    @ApiModelProperty(value = "数据来源填 实时物流小程序  四流平台")
    private String dataSource;

    private Boolean bind;

    private boolean viewFlag;


    public String getCreateUser() {
        return phone;
    }
}
